{include file="header"}
<div style="padding: 20px;">
 
<div style="padding: 10px; font-size: 12px; background-color: #f6f6f6; color: #FF5722;margin-bottom:10px"> 
<span style="">【温馨提示】:当开启联动时候字段必填请关闭 未选择字段不受影响</span>
</div>
 
<form class="layui-form layui-form-pane" action="">
<input type="hidden" name="id" value="{$id}">	
<table class="layui-table" lay-size="lg">
  <colgroup>
    <col width="200">
    <col width="800">
    <col width="200">
    <col>
  </colgroup>
  <thead>
    <tr>
      <th>选项</th>
      <th>是否联动</th>
      <th>操作</th>
    </tr> 
  </thead>
  <tbody>
    <tr>
      <td>开关</td>
      <td>
      <input type="radio" name="liandong" value="1" title="是" {if condition="$c['liandong'] eq 1"}checked{/if}>
      <input type="radio" name="liandong" value="0" title="否" {if condition="$c['liandong'] eq 0"}checked{/if}>
      </td>
      <td><button class="layui-btn" lay-submit lay-filter="cms">立即提交</button></td>
    </tr>
  </tbody>
</table>
</form>
<form class="layui-form layui-form-pane" action="">
<input type="hidden" name="id" value="{$id}">	
<table class="layui-table" lay-size="lg">
  <colgroup>
    <col width="200">
    <col width="800">
    <col width="200">
    <col>
  </colgroup>
  <thead>
    <tr>
      <th>选项</th>
      <th>隐藏字段</th>
      <th>操作</th>
    </tr> 
  </thead>
  <tbody>
 
    <tr>
      <td>未选择时</td>
      <td>
      	{volist name=":fun_S('modelZiduan',array('tid'=>$c['tid']),'px desc','1000',1)" id="vs"}
      	{if condition="$vs['name'] neq $c['name']"}
         <input  type="checkbox"  name="liandongzd[{$i}]" value="{$vs.name}" title="{$vs.title}"  {if condition="socha($c['liandongzd'],$vs['name']) eq '1'"}checked{/if}>
        {/if}
      	{/volist} 
      </td>
      <td><button class="layui-btn" lay-submit lay-filter="cms">立即提交</button></td>
    </tr>
  </tbody>
</table>
</form>
{volist name=":chaxun($c['morenzhi'])" id="vo"}
<form class="layui-form" action="">
<input type="hidden" name="model" value="{$c['tid']}">
<input type="hidden" name="ziduan" value="{$c['name']}">
<input type="hidden" name="dianji" value="{$vo.id}">
<table class="layui-table" lay-size="lg">
  <colgroup>
    <col width="200">
    <col width="800">
    <col width="200">
    <col>
  </colgroup>
  <thead>
    <tr>
      <th>选项</th>
      <th>隐藏字段</th>
      <th>操作</th>
    </tr> 
  </thead>
  <tbody>
 
    <tr>
      <td>选择({$vo.id})时</td>
      <td>
      	{volist name=":fun_S('modelZiduan',array('tid'=>$c['tid']),'px desc','1000',1)" id="vsc"}
      	{if condition="$vsc['name'] neq $c['name']"}
         <input  type="checkbox" name="yingchang[{$i}]"  value="{$vsc.name}" title="{$vsc.title}"  {if condition="socha(fun_sc_p('model_ziduan_l', array('model'=>$c['tid'],'ziduan'=>$c['name'],'dianji'=>$vo['id']), 'yingchang'),$vsc['name']) eq '1'"}checked{/if}>
        {/if}
      	{/volist} 
      </td>
      <td><button class="layui-btn" lay-submit lay-filter="cmsadd">立即提交</button></td>
    </tr>
  </tbody>
</table>
</form>
{/volist} 
<div>
{include file="footer"}
<script >
layui.use(['layedit', 'form', 'upload'],
function() {
    var form = layui.form,
    upload = layui.upload,
    jq = layui.jquery,
    layedit = layui.layedit;
    form.on('submit(cms)',function(data) {
        loading = layer.load(2, {
            shade: [0.2, '#000']
        });
        var param = data.field;
        jq.post("{:url("model/liandong")}", param,
        function(data) {
            if (data.code == 1) {
                layer.close(loading);
                layer.msg(data.msg, {
                    icon: 1,
                    time: 1000
                },
                function() {
                    location.reload();
                });
            } else {
                layer.close(loading);
                layer.msg(data.msg, {
                    icon: 2,
                    anim: 6,
                    time: 1000
                });
            }
        });
        return false;
    });
    form.on('submit(cmsadd)',function(data) {
        loading = layer.load(2, {
            shade: [0.2, '#000']
        });
        var param = data.field;
        jq.post("{:url("model/liandongadd")}", param,
        function(data) {
            if (data.code == 1) {
                layer.close(loading);
                layer.msg(data.msg, {
                    icon: 1,
                    time: 1000
                },
                function() {
                    location.reload();
                });
            } else {
                layer.close(loading);
                layer.msg(data.msg, {
                    icon: 2,
                    anim: 6,
                    time: 1000
                });
            }
        });
        return false;
    });
})
</script>
